package org.lagou.resultsethandler;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
import java.util.List;

import org.apache.commons.dbutils.ResultSetHandler;
import org.lagou.bean.CompanyBean;
import org.lagou.bean.IssueBean;

public class IssueBeanResultSetHandler implements ResultSetHandler<List<IssueBean>>{

	@Override
	public List<IssueBean> handle(ResultSet rs) throws SQLException {
		List<IssueBean> list=new ArrayList<IssueBean>();
		while (rs.next()) {
			IssueBean info=new IssueBean();
			info.setId(rs.getInt("id"));
			info.setName(rs.getString("name"));
			info.setCompanyid(rs.getInt("companyid"));
			//info.setCategory(rs.getString("category"));
			//info.setDept(rs.getString("dept"));
			//info.setNature(rs.getString("nature"));
			info.setMinsalary(rs.getInt("minsalary"));
			info.setMaxsalary(rs.getInt("maxsalary"));
			info.setCity(rs.getString("city"));
			info.setExperience(rs.getString("experience"));
			info.setEducation(rs.getString("education"));
			info.setTemptation(rs.getString("temptation"));
			info.setSummary(rs.getString("summary"));
			info.setAddress(rs.getString("address"));
			info.setEmail(rs.getString("email"));
			info.setCompanyname(rs.getString("companyname"));
			//info.setDate(rs.getString("date"));
			//info.setDel(rs.getInt("del"));
			
			CompanyBean cinfo=new CompanyBean(rs.getInt("companyid"),rs.getInt("userid"),rs.getString("name"), rs.getString("field"), 
					rs.getString("scale"), rs.getString("stage"), rs.getString("tag"), rs.getString("generator"),rs.getString("logo"),rs.getString("url"));
			info.setCinfo(cinfo);
			
			list.add(info);
		}
		return list;
	}

}
